package com.dataeco.api.dto.helper;

import com.dataeco.api.dto.BankAccountInfo;
import com.dataeco.api.entity.BankAccount;

import java.util.ArrayList;
import java.util.List;


public class BankAccountHelper {

    public List<BankAccountInfo> convertBankAccountEntityToBankAccountInfo(List<BankAccount> bankAccountList){
        List<BankAccountInfo> bankAccountInfoList=new ArrayList<>();
        for (BankAccount bankAccount:bankAccountList) {
            BankAccountInfo bankAccountInfo=new BankAccountInfo();
            bankAccountInfo.setCountry(bankAccount.getCountry());
            bankAccountInfo.setBankName(bankAccount.getBankName());
            bankAccountInfo.setBankLocation(bankAccount.getLocation());
            bankAccountInfo.setPostcode(bankAccount.getPostcode());
            bankAccountInfo.setAccountName(bankAccount.getAccountName());
            bankAccountInfo.setCompanyAddress(bankAccount.getCompanyAddress());
            bankAccountInfo.setAccountNum(bankAccount.getAccountNumber());
            bankAccountInfo.setBankcode(bankAccount.getBankcode());
            bankAccountInfo.setCodeType(bankAccount.getCodeType());
            bankAccountInfo.setCurrency(bankAccount.getCurrency());
            bankAccountInfoList.add(bankAccountInfo);
        }

        return bankAccountInfoList;
    }
    public BankAccountInfo convertBankAccountEntityToBankAccountInfo1(BankAccount bankAccount){
            BankAccountInfo bankAccountInfo=new BankAccountInfo();
            bankAccountInfo.setCountry(bankAccount.getCountry());
            bankAccountInfo.setBankName(bankAccount.getBankName());
            bankAccountInfo.setBankLocation(bankAccount.getLocation());
            bankAccountInfo.setPostcode(bankAccount.getPostcode());
            bankAccountInfo.setAccountName(bankAccount.getAccountName());
            bankAccountInfo.setCompanyAddress(bankAccount.getCompanyAddress());
            bankAccountInfo.setAccountNum(bankAccount.getAccountNumber());
            bankAccountInfo.setBankcode(bankAccount.getBankcode());
            bankAccountInfo.setCodeType(bankAccount.getCodeType());
            bankAccountInfo.setCurrency(bankAccount.getCurrency());

        return bankAccountInfo;
    }

    public BankAccount convertBankAccountInfoToBankAccount(BankAccountInfo bankAccountInfo){
        BankAccount bankAccount=new BankAccount();
        bankAccount.setCountry(bankAccountInfo.getCountry());
        bankAccount.setBankName(bankAccountInfo.getBankName());
        bankAccount.setLocation(bankAccountInfo.getBankLocation());
        bankAccount.setPostcode(bankAccountInfo.getPostcode());
        bankAccount.setAccountName(bankAccountInfo.getAccountName());
        bankAccount.setCompanyAddress(bankAccountInfo.getCompanyAddress());
        bankAccount.setAccountNumber(bankAccountInfo.getAccountNum());
        bankAccount.setBankcode(bankAccountInfo.getBankcode());
        bankAccount.setCodeType(bankAccountInfo.getCodeType());
        bankAccount.setCurrency(bankAccountInfo.getCurrency());
        return bankAccount;
    }
}
